#!/bin/bash
user_input_name=`basename $0`
if [ $# == 0 ] ; then
printf "usage: %s 302\n" "$user_input_name"
printf "       %s 302 tail\n" "$user_input_name"
printf "       you can change 302 to your process id.\n" 
exit
    fi

printf "the process log you want to see is:%d\n" $1
cd $HOME/log
(
 pid_=`zxstat | grep $1| grep 251 | awk '{print $2}'`
 if [ ! -n "$pid_" ] ; then
     zxstat
printf "process %d not found,by zxstat\n" $1
exit
     fi

 printf "the process id is:%d\n"  $pid_

 log_name="ULOG*"$pid_"*"
 printf "the log file is:%s\n" $log_name;

if [ -f $log_name ] ; then

 if [ "$2" == "tail" ]  ; then
 tail -f $log_name
 else 
 vim $log_name
 fi
 else
printf "file [%s] do not exsit.\n" $log_name
     fi
 )


